<?php

       
		//获取发送图片URL
        $PicUrl = $postObj->PicUrl;
        //创建新的图片名称
        $NewName = $fromUsername . date("YmdHis") . ".jpg";
        //创建抓取图片类
        $f = new SaeFetchurl();
        //抓取图片
        $res = $f->fetch($PicUrl);
        //如果抓取到图片
        if ($f->errno() == 0) 
        {
            //新建存储类
            $s = new SaeStorage();
            //写入图片
            $s->write("weixincourse", $NewName, $res);
            $PicUrl = $s->getUrl("weixincourse", $NewName);
        } 
        else 
        {
            exit;
        }

        $name= $address_book['student_name'];
        $title = "亲爱的".$name."同学  你的照片上传成功啦！！！";
        $Description = '输入【查】可查看图片 输入【菜单】可查看所有功能';
        $mysql->runSql("INSERT INTO  `app_scnuzs`.`photo` (`ticket_number` ,`address`,`student_name`)VALUES ('0',  '$PicUrl','$name');"); //插入图片;
        $url = '';
        $resultStr = sprintf($imageTpl, $fromUsername, $toUsername, $title, $Description, $PicUrl, $url);
        echo $resultStr;
        exit();


?>